#pragma once

#include <string_view>

namespace Shaders
{
    std::string_view const SelectedObjectGS = R"(
#version 330 core
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;

in vec2 vWorldPos[];
flat in int vHasSignalRestriction[];
flat in float vStartAngle[];
flat in float vEndAngle[];

out vec2 gWorldPos;
out vec2 gQuadCoord;
flat out int gHasSignalRestriction;
flat out float gStartAngle;
flat out float gEndAngle;

uniform vec2 viewportSize;
uniform float zoom;
uniform float radius;

void main()
{
    gWorldPos = vWorldPos[0];
    gHasSignalRestriction = vHasSignalRestriction[0];
    gStartAngle = vStartAngle[0];
    gEndAngle = vEndAngle[0];
    
    // Circle radius in world coordinates (thin white circle)
    float circleRadius = radius * 0.35;
    
    // Calculate size in NDC coordinates
    float ndcHalfWidth = circleRadius / viewportSize.x * 2.0;
    float ndcHalfHeight = circleRadius / viewportSize.y * 2.0;
    
    // Get center position
    vec4 center = gl_in[0].gl_Position;
    
    // Generate quad (4 vertices as triangle strip)
    // Bottom-left
    gl_Position = vec4(center.xy + vec2(-ndcHalfWidth, -ndcHalfHeight), center.z, 1.0);
    gQuadCoord = vec2(-0.5, 0.5);
    EmitVertex();
    
    // Bottom-right
    gl_Position = vec4(center.xy + vec2(ndcHalfWidth, -ndcHalfHeight), center.z, 1.0);
    gQuadCoord = vec2(0.5, 0.5);
    EmitVertex();
    
    // Top-left
    gl_Position = vec4(center.xy + vec2(-ndcHalfWidth, ndcHalfHeight), center.z, 1.0);
    gQuadCoord = vec2(-0.5, -0.5);
    EmitVertex();
    
    // Top-right
    gl_Position = vec4(center.xy + vec2(ndcHalfWidth, ndcHalfHeight), center.z, 1.0);
    gQuadCoord = vec2(0.5, -0.5);
    EmitVertex();
    
    EndPrimitive();
}
)";
}
